
#pragma once

#include "type.h"

static const char* SKILL_TYPE_NAMES[] = {
	"none",
	"damage",
	"speed_up",
	"slow_down",
	"decrease_shield",
	"increase_shield",
	"weaken", 
	"god_mode",
	"dizzy",
	"freeze",
	"poison",
	"fire",
	"heal",
	"summon",
	"smash",
	"invisible",
	"critical_strike",
};

enum SkillType{
	st_none = 0,
	st_damage,
	st_speedUp,
	st_slowDown,
	st_decreaseShield,
	st_increaseShield,
	st_weaken, // st_slowDown && st_decreaseShield
	st_godMode,
	st_dizzy,
	st_freeze,
	st_poison,
	st_fire,
	st_heal,
	st_summon,
	st_smash,
	st_invisible,
	st_criticalStrike,
	st_count
};

struct SkillAttribute {
	SkillType type;
	int id;         // unique id
	int uid;        // who made the skill, not be applied
	int tid;        // which tower made the skill
	float value;
	float duration;
	float chance;
	float range;
	float interval; // 0 means skill always be valid while the unit stay inside the range of caster, < 0 means the skill never be used, but interval can be changed at runtime

	SkillAttribute() {
		memset(this, 0, sizeof(SkillAttribute));
		newId();
	}

	void from(const SkillAttribute& attr) {
		type = attr.type;
		uid =  attr.uid;
		tid = attr.tid;
		value = attr.value;
		duration = attr.duration;
		chance = attr.chance;
		range = attr.range;
		interval = attr.interval;
	}

	void newId() {
		static int seed = 10000; // greater than maximum quantity of monsters
		id = seed++;
	}
};
